Page({
  data: {
    baidu_img:"",
    baidu_name:"",
    content:[]
  },
  more(e){
    var id = e.currentTarget.dataset.id
    wx.navigateTo({
      url: '/pages/webViewPage/webViewPage?url='+this.data.baidu_url[id+1],
    })
  },
  watch_more(){
    wx.navigateTo({
      url: '/pages/webViewPage/webViewPage?url='+this.data.baidu_url[0],
    })
  },
  back(){
    wx.navigateBack({
      delta: 1,
    })
  },
  onLoad(options) {
    var name = JSON.parse(options.name)
    var score = JSON.parse(options.score)
    var baidu_image = JSON.parse(options.baidu_image)
    var introduce = JSON.parse(options.introduce)
    var baidu_url = JSON.parse(options.baidu_url)
    var class1 = options.class1
    var user_img = options.user_img
    console.log(score)
    var score1= []
    for (let i = 0; i < 3; i++) {
      score1.push(score[i].toFixed(2))
    }
    console.log(score1)
    this.setData({
      baidu_url:baidu_url,
      user_img:user_img,
      class1:class1,
      baidu_name:name[0],
      baidu_img:baidu_image[0],
      content:[{
        1:class1,
        2:introduce,
        3:""
      },{
        1:"相似度",
        2:score1[0]+"%",
        3:""
      },{
        1:"其他相似",
        3:[{
          1:baidu_image[1],
          2:name[1],
          3:score1[1]
        },{
          1:baidu_image[2],
          2:name[2],
          3:score1[2]
        }]
      }]
    })
  }
})